//  toast的类型(success, danger, info)
export default {
    namespaced: true,
    state: {
        isShowToast: false,
        toastMsg: "",
        toastType: ""
    },
    mutations: {
        changeIsShowToast(state, payload) {
            state.isShowToast = payload.show
            if (payload.show) {
                state.toastMsg = payload.msg
                state.toastType = payload.type
            }
        }
    },
    actions: {
        asyncChangeIsShowToast({ commit }, payload) {
            commit("changeIsShowToast", payload)
            setTimeout(() => {
                commit("changeIsShowToast", {
                    show: false
                })
            }, 1000);
        }
    }
}